#include <nxos.h>
#include <PowerBox.h>

NX_Error PowerBoxBuiltinSleep(int argc, char *argv[], char * env)
{
    NX_U32 ms;
    if (argc < 2)
    {
        NX_Printf("Usage:\n  sleep [ms]\n");
        return NX_EAGAIN;
    }

    ms = NX_StrToUL(argv[1], NX_NULL, 10);

    if (!ms)
    {
        ms = 1000;
    }

    NX_Printf("sleep %d ms\n", ms);

    NX_ThreadSleep(ms);

    return NX_EOK;
}
